﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MP3Ganizer.Common.Interfaces.FileList;
using MP3Ganizer.Common.BaseObject;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Composite.Events;
using MP3Ganizer.Common;
using MP3Ganizer.Modules.FileList.Views;
using MP3Ganizer.Modules.FileList.ViewModels;

namespace MP3Ganizer.Modules.FileList.Controllers
{
    class FileListController : BaseModuleController, IFileListController
    {
        public FileListController(IUnityContainer container, IRegionManager regionManager, IEventAggregator eventAggregator)
            : base(container, regionManager, eventAggregator)
        {
        }
        protected override void SubscribeCompositeEvent()
        {
            
        }

        public override void Run()
        {
            _regionManager.RegisterViewWithRegion(RegionNames.Center3, () => RegisterView());
            //_regionManager.RegisterViewWithRegion(RegionNames.Right, () => RegisterView());
        }


        private IFileListView RegisterView()
        {
            FileListView view = _container.Resolve<FileListView>();
            FileListViewModel viewModel = (FileListViewModel)view.DataContext;
            viewModel.Initialize();
            return view;
        } 
    }
}
